package com.sptpc.mall.controller;

import com.sptpc.mall.model.Category;
import com.sptpc.mall.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    public CategoryService categoryService;

    @PatchMapping("/insert")
    @ResponseBody
    public Category insert(@RequestParam(name = "name") String name){

        return categoryService.saveCategory(name);
    }
}
